feat: Git configure edit modal#1017
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a GET /v2/git endpoint and supporting plumbing to let the console’s “Git configure edit” modal prefill existing Git configuration values from the API.
Changes:
- Extends
SettingsInfo.otomi.gitto includeusername,password, andemail. - Adds
OtomiStack.getGitSettings()and a newGET /v2/gitoperation handler. - Updates OpenAPI routes and ACL for
AplGitto allow non-platform roles to read Git settings.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/otomi-stack.ts |
Adds git fields into getSettingsInfo() projection and introduces getGitSettings() helper. |
src/api/v2/git.ts |
Adds the GET /v2/git handler that returns current git settings. |
src/openapi/api.yaml |
Defines GET /v2/git in the API spec. |
src/openapi/settingsinfo.yaml |
Documents additional otomi.git fields in SettingsInfo. |
src/openapi/git.yaml |
Adjusts ACL so team roles can read AplGit. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'git.repoUrl', | ||
| 'git.branch', | ||
| 'git.username', | ||
| 'git.password', | ||
| 'git.email', |
There was a problem hiding this comment.
I certainly think so, too. The password should never be there to read. Even if it may be encrypted there is no reason to send it back to the client at all.
| async getGitSettings(): Promise<{ | ||
| repoUrl?: string | ||
| branch?: string | ||
| username?: string | ||
| password?: string | ||
| email?: string | ||
| }> { | ||
| const settingsInfo = await this.getSettingsInfo() | ||
| const git = settingsInfo.otomi?.git | ||
|
|
||
| return { | ||
| repoUrl: git?.repoUrl, | ||
| branch: git?.branch, | ||
| username: git?.username, | ||
| password: git?.password, | ||
| email: git?.email, | ||
| } | ||
| } |
There was a problem hiding this comment.
I agree with that. Sending back passwords, even in encrypted form, suggests that secrets are exposed. Console can just insert placeholders.
| export const getGitSettings = async (req: OpenApiRequestExt, res: Response): Promise<void> => { | ||
| debug('getGitSettings') | ||
|
|
||
| const gitSettings = await req.otomi.getGitSettings() | ||
|
|
||
| res.json(gitSettings) | ||
| } |
| password: | ||
| type: string | ||
| description: The password or personal access token used to authenticate with the Git repository. | ||
| email: | ||
| type: string | ||
| description: The email address used for Git commit author information. | ||
| format: email |
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/AplGit' |
| - update-any | ||
| teamAdmin: [] | ||
| teamMember: [] | ||
| teamAdmin: |
There was a problem hiding this comment.
why allowing teams to read this data?
console: linode/apl-console#806
api: #1017